package xin.infinite.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import xin.infinite.pojo.User;
import xin.infinite.service.UserService;
import xin.infinite.vo.JsonResult;

/**
 * @author shkstart
 * @Date 2020/6/11 0011 - 15:04
 */
@Controller
@RequestMapping("/user")
public class UserController {
    @Autowired
    private UserService userService;

    /**
     * url:user/doLogin
     *参数:username,password
     * 返回值:JsonResult
     * */
    @RequestMapping("/doLogin")
    public JsonResult doLogin(String username,String password){
        boolean filg=userService.findUserByUP(username,password);

        return  filg?JsonResult.success():JsonResult.fail();
    }
    /**
     *  url:user/doSave
     *  参数:user
     *  返回值:JsonResult
     * */
   public JsonResult doSave(User user){

       userService.doSave(user);

       return JsonResult.success();
   }

}
